package com.wang.bootbuilder.controller;

import com.wang.bootbuilder.entity.param.LoginParam;
import com.wang.bootbuilder.execption.CaptchaException;
import com.wang.bootbuilder.service.LoginService;
import com.wang.bootbuilder.tools.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(value = "/login", description = "处理登录请求的controller")
public class LoginController {

    @Autowired
    LoginService loginService;

    @PostMapping("/login")
    @ApiOperation(value = "用户登录", notes = "根据用户名密码判断用户是否可以登录")
    public JsonResult login(@RequestBody LoginParam param) {
        JsonResult result = loginService.login(param);
        return result;
    }
}
